import Vue from "vue";
import VueRouter from "vue-router";

// if (process.env.NODE_ENV === "development") {
    Vue.use(VueRouter);
// }

import { ROUTER_MODE } from "../config/app";

import Home from "../views/home/index.vue";


import TestPage from "../views/testpage/TestPage.vue"
import Login from "../views/login/Login.vue"
import Router from "../views/router.vue"
import About from "../views/About.vue"

import app_login from "../views/login/app"
import data from "../views/data"
import analyse from '../views/analyse'

// Vue.use(VueRouter);

const err404 = r =>
    require.ensure([], () => r(require("../views/error/err404.vue")), "home");

// 注意 权限字段 authRule （严格区分大小写）
export const constantRouterMap = [
    {
        path: "*",
        component: err404,
        hidden: true
    },
    {
        path: "/login",
        component: app_login,
        name: "hj_登录",
        hidden: true
    },
    {
        path: "/datapage",
        component: data,
        name: "监控主页",
        hidden: true
    },
    {
        path: "/",
        component: Router,
        redirect: "/datapage",
        name: "首页",
        hidden: true
    },
    {
        path: "/aboutcompany",
        component: Home,
        redirect: "/aboutcompany/about",
        icon: "shiyongwendang",
        name: "关于公司",
        noDropdown: true,
        children: [
            {
                path: "about",
                name: "公司信息",
                component: About
            }
        ]
    }
];

export default new VueRouter({
    mode: 'hash', //后端支持可开
    // mode: ROUTER_MODE,
    routes: constantRouterMap,
    strict: process.env.NODE_ENV !== "production"
});

import wangge from './submenu/wangge'
import danwei from './submenu/danwei'
import zichan from './submenu/zicha'
import jiankong from './submenu/jiankong'
import gaojing from './submenu/gaojing'
import shijian from './submenu/shijian'
import zicha from './submenu/zicha'
import jiedianguanli from './submenu/jiedianguanli'
import xitong from './submenu/xitong'
import baobiao from './submenu/baobiao'
import shitaiganzhi from './submenu/shitaiganzhi'


export const asyncRouterMap = [
    {
        path: "/datapage1",
        component: Router,
        redirect: "/datapage",
        icon: "shiyongwendang",
        name: "首页",
        noDropdown: true,
        children: [
            {
                path: "index",
                name: "监控主页1",
                component: data
            }
        ]
    },
    wangge,
    danwei,
    zichan,
    jiankong,
    gaojing,
    shijian,
    zicha,
    jiedianguanli,
    xitong,
    baobiao,
    shitaiganzhi,
    
];
